﻿<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>员工面板</title>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%> 
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    
    <script src="<%=path%>/static/miniui/boot.js" type="text/javascript"></script>
    

    <style type="text/css">
    html, body
    {
        font-size:12px;
        padding:0;
        margin:0;
        border:0;
        height:100%;
        overflow:hidden;
    }
    </style>
</head>
<body>    
     
    <form id="form1" method="post">
      
        <div style="padding-left:11px;padding-bottom:5px;">
            <table style="table-layout:fixed;">
                <tr>
                    <td style="width:70px;">贴子标题</td>
                    <td style="width:150px;">    
                        <input name="postTitle" class="mini-textbox" required="true"  emptyText="请输入标题"/>
                    </td>
                    <td style="width:70px;">发帖人</td>
                     <td style="width:150px;">    
                        <input name="postUsername" class="mini-textbox" required="true"  emptyText="请输入发帖人"/>
                    </td>
                     
                </tr>
                <tr>
                   <td style="width:70px;">发帖时间</td>
                     <td style="width:150px;">    
                        <input name="postCreatetime" class="mini-datepicker" style="width:100%;" required="true"  emptyText="请输入发帖时间"/>
                    </td>
                    
                </tr>
                <tr>
                   <td style="width:70px;">发帖人编号</td>
                     <td style="width:150px;">    
                        <input name="userid" class="mini-spinner" style="width:100%;" value="0" />
                    </td>
                    
                </tr>
                 <tr>
                   <td style="width:70px;">阅读数</td>
                     <td style="width:150px;">    
                        <input name="postRead" class="mini-spinner" style="width:100%;" value="0" "/>
                    </td>
                    
                </tr>
                  <tr>
                   <td style="width:70px;">回复数</td>
                     <td style="width:150px;">    
                        <input name="postResponse" class="mini-spinner" style="width:100%;" value="0" />
                    </td>
                    
                </tr>
                <tr>
                <td >发帖内容</td>
                <td colspan="3">    
                    <input name="postContent" class="mini-textarea" style="width:350px;" required="true"  emptyText="请输入发帖时间"/>
                </td>
            </tr>     
                   
            </table>
        </div>
        <div style="text-align:center;padding:10px;">               
            <a class="mini-button" onclick="onOk" style="width:60px;margin-right:20px;">确定</a>       
            <a class="mini-button" onclick="onCancel" style="width:60px;">取消</a>       
        </div>        
    </form>
    <script type="text/javascript">
      mini.parse();
    var form = new mini.Form("form1");
    function SaveData() {
        var o = form.getData();            

        form.validate();
        if (form.isValid() == false) return;

        var json = mini.encode([o]);
        $.ajax({
            url: "add",
	        type: 'post',
            data: { data: json },
            cache: false,
            success: function (text) {
                CloseWindow("save");
            },
            error: function (jqXHR, textStatus, errorThrown) {
                alert(jqXHR.responseText);
                CloseWindow();
            }
        });
    }

    ////////////////////
    //标准方法接口定义
    function SetData(data) {
        if (data.action == "edit") {
            //跨页面传递的数据对象，克隆后才可以安全使用
            data = mini.clone(data);
            
            $.ajax({
                url: "findById?id=" + data.id,
                cache: false,
                success: function (text) {
                    var o = mini.decode(text);
                    form.setData(o);
                    form.setChanged(false);
                   /*  onDeptChanged();
                    mini.getbyName("position").setValue(o.position); */
                }
            });
        }
    }

    function GetData() {
        var o = form.getData();
        return o;
    }
    function CloseWindow(action) {            
        if (action == "close" && form.isChanged()) {
            if (confirm("数据被修改了，是否先保存？")) {
                return false;
            }
        }
        if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
        else window.close();            
    }
    function onOk(e) {
        SaveData();
    }
    function onCancel(e) {
        CloseWindow("cancel");
    }
   


    </script>
</body>
</html>
